import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QDesktopWidget, QHBoxLayout, QWidget, QPushButton
from PyQt5.QtGui import QIcon


class Mainwin_demo(QMainWindow):
    def __init__(self):
        super(Mainwin_demo, self).__init__()
        self.initUI()

    def initUI(self):
        self.setGeometry(300, 300, 250, 250)
        # 设置主窗口标题
        self.setWindowTitle('第一个主窗口')
        # 设置窗口图标
        self.setWindowIcon(QIcon('D:\python-project\py14.PyQt5\imgs\万圣节-蝙蝠.ico'))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    # app.setWindowIcon(QIcon('D:\python-project\py14.PyQt5\imgs\万圣节-蝙蝠.ico'))
    main = Mainwin_demo()
    main.show()
    sys.exit(app.exec_())
